Repository navigation
Extract every patch segment and decode byte lines - #78
Closed
Anurag-S1ngh wants to merge 1 commit into
Closed
Anurag-S1ngh wants to merge 1 commit into
Anurag-S1ngh wants to merge 1 commit into
Conversation
patch.extract joined the lines from patch_info as text, but the patch library returns bytes, so extraction raised 'expected str instance, bytes found'. Decode byte lines as UTF-8 with a Latin-1 fallback and strip them in patch_info. Also move the return out of the loop so every patch segment is written, not just the first. Add regression tests for both cases. Signed-off-by: Anurag Singh <anuragsingh2313@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
extractcode --all-formats libmediainfo-0.7.43.diffraisedsequence item 0: expected str instance, bytes found.patch_info()yields whatever thepatchlibrary returns, and that library returns bytes lines, whileextract()joins them as text. The same loop also returned after the first patch segment, so a multi-patch file only produced one extracted file.Changes
patch_text()with UTF-8 and fall back to Latin-1, then strip, sopatch_info()always yields text lines.return []outside the loop inextract()so every patch segment is written.libmediainfopatch from the report.Testing
pytest tests/test_patch.py: 199 passed, 2 xfailed.mainin the same environment: 83 failed, 433 passed, 33 skipped, 10 xfailed. The six extra fixes are the patch tests that were failing because of the same byte decoding. The remaining failures need the 7z and rar extraction plugins, which are not installed here.ruff checkandruff format --checkpass.dnsmasq_2.63-1.diffnow writes 19 subfiles for 19 segments, andunionfs-2.5.1_for_2.6.23.17.diffwrites 43 for 43.Closes #57